<?php
class PNAjaxTambonArray extends PNObjectExArray {
  function PNAjaxTambonArray($init=null, $where='')
  {
    $this->PNObject();

    $this->_objType       = 'votethailandpoll_tambon';
    $this->_objField      = 'id';
    $this->_objPath       = 'form';

    $this->_init($init, $where);
  }

  function genSort(){
    return " ORDER BY tam_name ASC";
  }

  function genFilter(){
    $pro_id  = FormUtil::getPassedValue ('pro_id', false);
    $dis_id  = FormUtil::getPassedValue ('dis_id', false);

    $wheres = array();
    if ($pro_id && intval($pro_id)) $wheres[] = " tam_pro_id = ".$pro_id;
    if ($dis_id && intval($dis_id)) $wheres[] = " tam_dis_id = ".$dis_id;
    //var_dump($wheres);
    return implode(' AND ', $wheres) ;
  }
}
